import random
#
# nums = [random.randint(-10, 10) for x in range(20)]
#
# def quick_sort(nums):
#     if len(nums) <= 1:
#         return nums
# # 随意选取一个基准数，比如选取列表第一个数
#     base = nums[0]
# # left列表为nums中比基准数base小或等于base的数组成的列表
#     left = [x for x in nums[1:] if x <= base]
# # right列表为nums中比基准数base大的数组成的列表
#     right = [x for x in nums[1:] if x > base]
# # 对left和right列表递归排序
#     return quick_sort(left) + [base] + quick_sort(right)
# print (nums)
#
# # 对nums数组排序
# print (quick_sort(nums))


# def quick_sort(nums):
#     if len(nums) <= 1:
#         return nums
#     base = nums[0]
#     left = [x for x in nums[1:] if x <= base]
#     right = [x for x in nums[1:] if x > base]
#     return quick_sort(left) + [base] + quick_sort(right)
#
# print(quick_sort([2,3,5,65,3,4,2,7,4,9,7,]))

#a 导入广告收入
a = 1000
#b 税率
b = 0.0972
#c 附加扣除,100%为“1”，70%为 0.7，配置多少给多少
c = 1
#d 游戏分成比例-扣减
d1 = 1 - 0.25
d2 = 1 - 0.35
d3 = 1 - 0.3
d4 = 1 - 0.4
#e 游戏分成比例+负数增加
e1 = 1 + 0.1
e2 = 1 + 0.2
e3 = 1 + 0.3
e4 = 1 + 0.4

ksje = a * (1 - b)
print("第一层计算-扣税：",b , "，后预期输入金额为：", "%.2f" %ksje)

kcfj = ksje * 1
print("第二层计算-扣除附加：",c , "，后预期金额为：", "%.2f" %kcfj)
print("\n以下为扣减分成，扣除金额")
lastmoney1 = kcfj * d1
lastmoney2 = kcfj * d2
lastmoney3 = kcfj * d3
lastmoney4 = kcfj * d4
print("第四层计算-【国内】游戏分成比例：",[d1] ,"，最后收入金额为：", "[%.2f]" %lastmoney1)
print("第四层计算-【国内】游戏分成比例：",[d2] ,"，最后收入金额为：", "[%.2f]" %lastmoney2)
print("第四层计算-【国外】游戏分成比例：",[d3] ,"，最后收入金额为：", "[%.2f]" %lastmoney3)
print("第四层计算-【国外】游戏分成比例：",[d4] ,"，最后收入金额为：", "[%.2f]" %lastmoney4)
print("\n以下为增加金额分成，增加金额")
lastmoney_1 = kcfj * e1
lastmoney_2 = kcfj * e2
lastmoney_3 = kcfj * e3
lastmoney_4 = kcfj * e4
print("第四层计算-【国内】游戏分成比例：",[e1] ,"，最后收入金额为：", "[%.2f]" %lastmoney_1)
print("第四层计算-【国内】游戏分成比例：",[e2] ,"，最后收入金额为：", "[%.2f]" %lastmoney_2)
print("第四层计算-【国外】游戏分成比例：",[e3] ,"，最后收入金额为：", "[%.2f]" %lastmoney_3)
print("第四层计算-【国外】游戏分成比例：",[e4] ,"，最后收入金额为：", "[%.2f]" %lastmoney_4)


#差额倒推公式
diff = 30000
print("差额：%.2f" %diff)
diff1 = diff / 1
print("反推1：%.2f" %diff1)
diff2 = diff1 / 0.9028
print("最后金额: %.2f" %diff2)
diff3 = diff2 / 0.85
print("ops金额：%.2f" %diff3)
#计算剩余资金
bg1 = 50000-diff2
print("bg1-----%.2f" %bg1)
bg2 = bg1 * 0.9028
bg3 = bg2 * 0.9
bg4 = bg3 * 0.85
print("剩余金额：%.2f" %bg4)
#额度总和
print(diff + bg4)